{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Working with DRKG in Deep Graph Library (DGL)\n",
    "This notebook provides an example of building a heterograph from DRKG in DGL; and some examples of queries on the DGL heterograph. For more information about using DGL please refer to https://www.dgl.ai/ \""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import dgl\n",
    "drkg_file = '~/covid/data/processed/filtered/drkg.tsv'\n",
    "df = pd.read_csv(drkg_file, sep =\"\\t\")\n",
    "triplets = df.values.tolist()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Assign an ID to each node (entity): create a dictionary of node-types: each dictionary further consists of a dictionary mapping node to an ID."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "entity_dictionary = {}\n",
    "def insert_entry(entry, ent_type, dic):\n",
    "    if ent_type not in dic:\n",
    "        dic[ent_type] = {}\n",
    "    ent_n_id = len(dic[ent_type])\n",
    "    if entry not in dic[ent_type]:\n",
    "         dic[ent_type][entry] = ent_n_id\n",
    "    return dic\n",
    "\n",
    "for triple in triplets:\n",
    "    src = triple[0]\n",
    "    split_src = src.split('::')\n",
    "    src_type = split_src[0]\n",
    "    dest = triple[2]\n",
    "    split_dest = dest.split('::')\n",
    "    dest_type = split_dest[0]\n",
    "    insert_entry(src,src_type,entity_dictionary)\n",
    "    insert_entry(dest,dest_type,entity_dictionary)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Create a dictionary of relations: the key is the relation and the value is the list of (source node ID, destimation node ID) tuples."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "edge_dictionary={}\n",
    "for triple in triplets:\n",
    "    src = triple[0]\n",
    "    split_src = src.split('::')\n",
    "    src_type = split_src[0]\n",
    "    dest = triple[2]\n",
    "    split_dest = dest.split('::')\n",
    "    dest_type = split_dest[0]\n",
    "    \n",
    "    src_int_id = entity_dictionary[src_type][src]\n",
    "    dest_int_id = entity_dictionary[dest_type][dest]\n",
    "    \n",
    "    pair = (src_int_id,dest_int_id)\n",
    "    etype = (src_type,triple[1],dest_type)\n",
    "    if etype in edge_dictionary:\n",
    "        edge_dictionary[etype] += [pair]\n",
    "    else:\n",
    "        edge_dictionary[etype] = [pair]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Create a DGL heterograph using the dictionary of relations"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "graph = dgl.heterograph(edge_dictionary);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Print the statistics of the created graph"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Number of nodes for each node-type"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Anatomy \t 400\n",
      "Atc \t 4048\n",
      "Biological Process \t 11381\n",
      "Cellular Component \t 1391\n",
      "Compound \t 24313\n",
      "Disease \t 4920\n",
      "Gene \t 39220\n",
      "Molecular Function \t 2884\n",
      "Pathway \t 1822\n",
      "Pharmacologic Class \t 345\n",
      "Side Effect \t 5701\n",
      "Symptom \t 415\n",
      "Tax \t 215\n",
      "Graph contains 97055 nodes from 13 node-types.\n"
     ]
    }
   ],
   "source": [
    "total_nodes = 0;\n",
    "for ntype in graph.ntypes:\n",
    "    print(ntype, '\\t', graph.number_of_nodes(ntype));\n",
    "    total_nodes += graph.number_of_nodes(ntype);\n",
    "print(\"Graph contains {} nodes from {} node-types.\".format(total_nodes, len(graph.ntypes)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Number of edges for each relation (edge-type)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bioarx::HumGenHumGen:Gene:Gene \t 58093\n",
      "bioarx::VirGenHumGen:Gene:Gene \t 535\n",
      "bioarx::DrugVirGen:Compound:Gene \t 1165\n",
      "bioarx::DrugHumGen:Compound:Gene \t 24501\n",
      "Covid2_acc_host_gene::Disease:Gene \t 332\n",
      "Coronavirus_ass_host_gene::Disease:Gene \t 129\n",
      "DGIDB::INHIBITOR::Gene:Compound \t 5971\n",
      "DGIDB::ANTAGONIST::Gene:Compound \t 3006\n",
      "DGIDB::OTHER::Gene:Compound \t 11070\n",
      "DGIDB::AGONIST::Gene:Compound \t 3012\n",
      "DGIDB::BINDER::Gene:Compound \t 143\n",
      "DGIDB::MODULATOR::Gene:Compound \t 243\n",
      "DGIDB::BLOCKER::Gene:Compound \t 979\n",
      "DGIDB::CHANNEL BLOCKER::Gene:Compound \t 352\n",
      "DGIDB::ANTIBODY::Gene:Compound \t 188\n",
      "DGIDB::POSITIVE ALLOSTERIC MODULATOR::Gene:Compound \t 618\n",
      "DGIDB::ALLOSTERIC MODULATOR::Gene:Compound \t 317\n",
      "DGIDB::ACTIVATOR::Gene:Compound \t 316\n",
      "DGIDB::PARTIAL AGONIST::Gene:Compound \t 75\n",
      "DRUGBANK::drugbank_vocabulary:x-atc::Compound:Atc \t 15750\n",
      "DRUGBANK::drugbank_vocabulary:ddi-interactor-in::Compound:Compound \t 1379271\n",
      "DRUGBANK::drugbank_vocabulary:target::Compound:Gene \t 19158\n",
      "DRUGBANK::drugbank_vocabulary:enzyme::Compound:Gene \t 4923\n",
      "DRUGBANK::drugbank_vocabulary:carrier::Compound:Gene \t 720\n",
      "GNBR::E::Compound:Gene \t 32743\n",
      "GNBR::A+::Compound:Gene \t 1568\n",
      "GNBR::N::Compound:Gene \t 12521\n",
      "GNBR::K::Compound:Gene \t 12411\n",
      "GNBR::A-::Compound:Gene \t 1108\n",
      "GNBR::E+::Compound:Gene \t 1970\n",
      "GNBR::B::Compound:Gene \t 7170\n",
      "GNBR::E-::Compound:Gene \t 2918\n",
      "GNBR::O::Compound:Gene \t 5573\n",
      "GNBR::Z::Compound:Gene \t 2821\n",
      "GNBR::T::Compound:Disease \t 54020\n",
      "GNBR::C::Compound:Disease \t 1739\n",
      "GNBR::Sa::Compound:Disease \t 16923\n",
      "GNBR::Pa::Compound:Disease \t 2619\n",
      "GNBR::Mp::Compound:Disease \t 495\n",
      "GNBR::Pr::Compound:Disease \t 966\n",
      "GNBR::J::Compound:Disease \t 1020\n",
      "GNBR::L::Gene:Disease \t 48385\n",
      "GNBR::U::Gene:Disease \t 6432\n",
      "GNBR::Y::Gene:Disease \t 1948\n",
      "GNBR::J::Gene:Disease \t 30234\n",
      "GNBR::Te::Gene:Disease \t 2836\n",
      "GNBR::Md::Gene:Disease \t 1279\n",
      "GNBR::G::Gene:Disease \t 2055\n",
      "GNBR::D::Gene:Disease \t 500\n",
      "GNBR::X::Gene:Disease \t 1324\n",
      "GNBR::Ud::Gene:Disease \t 407\n",
      "GNBR::V+::Gene:Gene \t 8689\n",
      "GNBR::Q::Gene:Gene \t 19372\n",
      "GNBR::Rg::Gene:Gene \t 11018\n",
      "GNBR::B::Gene:Gene \t 8164\n",
      "GNBR::I::Gene:Gene \t 5434\n",
      "GNBR::E+::Gene:Gene \t 10838\n",
      "GNBR::H::Gene:Gene \t 2509\n",
      "GNBR::W::Gene:Gene \t 280\n",
      "GNBR::E::Gene:Gene \t 418\n",
      "GNBR:in_tax::Gene:Tax \t 14663\n",
      "Hetionet::GpBP::Gene:Biological Process \t 559504\n",
      "Hetionet::GiG::Gene:Gene \t 147164\n",
      "Hetionet::CrC::Compound:Compound \t 6486\n",
      "Hetionet::DdG::Disease:Gene \t 7623\n",
      "Hetionet::DpS::Disease:Symptom \t 3357\n",
      "Hetionet::DlA::Disease:Anatomy \t 3602\n",
      "Hetionet::CtD::Compound:Disease \t 755\n",
      "Hetionet::CbG::Compound:Gene \t 11571\n",
      "Hetionet::CuG::Compound:Gene \t 18756\n",
      "Hetionet::DrD::Disease:Disease \t 543\n",
      "Hetionet::DaG::Disease:Gene \t 12623\n",
      "Hetionet::CpD::Compound:Disease \t 390\n",
      "Hetionet::AdG::Anatomy:Gene \t 102240\n",
      "Hetionet::AuG::Anatomy:Gene \t 97848\n",
      "Hetionet::GcG::Gene:Gene \t 61690\n",
      "Hetionet::GpMF::Gene:Molecular Function \t 97222\n",
      "Hetionet::PCiC::Pharmacologic Class:Compound \t 1029\n",
      "Hetionet::GpCC::Gene:Cellular Component \t 73566\n",
      "Hetionet::Gr>G::Gene:Gene \t 265672\n",
      "Hetionet::CdG::Compound:Gene \t 21102\n",
      "Hetionet::DuG::Disease:Gene \t 7731\n",
      "Hetionet::GpPW::Gene:Pathway \t 84372\n",
      "Hetionet::CcSE::Compound:Side Effect \t 138944\n",
      "Hetionet::AeG::Anatomy:Gene \t 526407\n",
      "INTACT::PHYSICAL ASSOCIATION::Compound:Gene \t 203\n",
      "INTACT::DIRECT INTERACTION::Compound:Gene \t 155\n",
      "INTACT::ASSOCIATION::Compound:Gene \t 1447\n",
      "INTACT::ASSOCIATION::Gene:Gene \t 112390\n",
      "INTACT::PHYSICAL ASSOCIATION::Gene:Gene \t 129318\n",
      "INTACT::COLOCALIZATION::Gene:Gene \t 3468\n",
      "INTACT::DEPHOSPHORYLATION REACTION::Gene:Gene \t 303\n",
      "INTACT::CLEAVAGE REACTION::Gene:Gene \t 93\n",
      "INTACT::DIRECT INTERACTION::Gene:Gene \t 6950\n",
      "INTACT::PHOSPHORYLATION REACTION::Gene:Gene \t 1328\n",
      "INTACT::ADP RIBOSYLATION REACTION::Gene:Gene \t 58\n",
      "INTACT::UBIQUITINATION REACTION::Gene:Gene \t 371\n",
      "INTACT::PROTEIN CLEAVAGE::Gene:Gene \t 67\n",
      "STRING::REACTION::Gene:Gene \t 400426\n",
      "STRING::CATALYSIS::Gene:Gene \t 343533\n",
      "STRING::ACTIVATION::Gene:Gene \t 81355\n",
      "STRING::INHIBITION::Gene:Gene \t 28959\n",
      "STRING::OTHER::Gene:Gene \t 310690\n",
      "STRING::BINDING::Gene:Gene \t 315875\n",
      "STRING::PTMOD::Gene:Gene \t 15113\n",
      "STRING::EXPRESSION::Gene:Gene \t 757\n",
      "Graph contains 5869293 edges from 106 edge-types.\n"
     ]
    }
   ],
   "source": [
    "total_edges = 0;\n",
    "for etype in graph.etypes:\n",
    "    print(etype, '\\t', graph.number_of_edges(etype))\n",
    "    total_edges += graph.number_of_edges(etype);\n",
    "print(\"Graph contains {} edges from {} edge-types.\".format(total_edges, len(graph.etypes)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Just printing the graph (\"print(graph)\") will also print the graph summary"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Graph(num_nodes={'Anatomy': 400, 'Atc': 4048, 'Biological Process': 11381, 'Cellular Component': 1391, 'Compound': 24313, 'Disease': 4920, 'Gene': 39220, 'Molecular Function': 2884, 'Pathway': 1822, 'Pharmacologic Class': 345, 'Side Effect': 5701, 'Symptom': 415, 'Tax': 215},\n",
      "      num_edges={('Gene', 'bioarx::HumGenHumGen:Gene:Gene', 'Gene'): 58093, ('Gene', 'bioarx::VirGenHumGen:Gene:Gene', 'Gene'): 535, ('Compound', 'bioarx::DrugVirGen:Compound:Gene', 'Gene'): 1165, ('Compound', 'bioarx::DrugHumGen:Compound:Gene', 'Gene'): 24501, ('Disease', 'Covid2_acc_host_gene::Disease:Gene', 'Gene'): 332, ('Disease', 'Coronavirus_ass_host_gene::Disease:Gene', 'Gene'): 129, ('Gene', 'DGIDB::INHIBITOR::Gene:Compound', 'Compound'): 5971, ('Gene', 'DGIDB::ANTAGONIST::Gene:Compound', 'Compound'): 3006, ('Gene', 'DGIDB::OTHER::Gene:Compound', 'Compound'): 11070, ('Gene', 'DGIDB::AGONIST::Gene:Compound', 'Compound'): 3012, ('Gene', 'DGIDB::BINDER::Gene:Compound', 'Compound'): 143, ('Gene', 'DGIDB::MODULATOR::Gene:Compound', 'Compound'): 243, ('Gene', 'DGIDB::BLOCKER::Gene:Compound', 'Compound'): 979, ('Gene', 'DGIDB::CHANNEL BLOCKER::Gene:Compound', 'Compound'): 352, ('Gene', 'DGIDB::ANTIBODY::Gene:Compound', 'Compound'): 188, ('Gene', 'DGIDB::POSITIVE ALLOSTERIC MODULATOR::Gene:Compound', 'Compound'): 618, ('Gene', 'DGIDB::ALLOSTERIC MODULATOR::Gene:Compound', 'Compound'): 317, ('Gene', 'DGIDB::ACTIVATOR::Gene:Compound', 'Compound'): 316, ('Gene', 'DGIDB::PARTIAL AGONIST::Gene:Compound', 'Compound'): 75, ('Compound', 'DRUGBANK::drugbank_vocabulary:x-atc::Compound:Atc', 'Atc'): 15750, ('Compound', 'DRUGBANK::drugbank_vocabulary:ddi-interactor-in::Compound:Compound', 'Compound'): 1379271, ('Compound', 'DRUGBANK::drugbank_vocabulary:target::Compound:Gene', 'Gene'): 19158, ('Compound', 'DRUGBANK::drugbank_vocabulary:enzyme::Compound:Gene', 'Gene'): 4923, ('Compound', 'DRUGBANK::drugbank_vocabulary:carrier::Compound:Gene', 'Gene'): 720, ('Compound', 'GNBR::E::Compound:Gene', 'Gene'): 32743, ('Compound', 'GNBR::A+::Compound:Gene', 'Gene'): 1568, ('Compound', 'GNBR::N::Compound:Gene', 'Gene'): 12521, ('Compound', 'GNBR::K::Compound:Gene', 'Gene'): 12411, ('Compound', 'GNBR::A-::Compound:Gene', 'Gene'): 1108, ('Compound', 'GNBR::E+::Compound:Gene', 'Gene'): 1970, ('Compound', 'GNBR::B::Compound:Gene', 'Gene'): 7170, ('Compound', 'GNBR::E-::Compound:Gene', 'Gene'): 2918, ('Compound', 'GNBR::O::Compound:Gene', 'Gene'): 5573, ('Compound', 'GNBR::Z::Compound:Gene', 'Gene'): 2821, ('Compound', 'GNBR::T::Compound:Disease', 'Disease'): 54020, ('Compound', 'GNBR::C::Compound:Disease', 'Disease'): 1739, ('Compound', 'GNBR::Sa::Compound:Disease', 'Disease'): 16923, ('Compound', 'GNBR::Pa::Compound:Disease', 'Disease'): 2619, ('Compound', 'GNBR::Mp::Compound:Disease', 'Disease'): 495, ('Compound', 'GNBR::Pr::Compound:Disease', 'Disease'): 966, ('Compound', 'GNBR::J::Compound:Disease', 'Disease'): 1020, ('Gene', 'GNBR::L::Gene:Disease', 'Disease'): 48385, ('Gene', 'GNBR::U::Gene:Disease', 'Disease'): 6432, ('Gene', 'GNBR::Y::Gene:Disease', 'Disease'): 1948, ('Gene', 'GNBR::J::Gene:Disease', 'Disease'): 30234, ('Gene', 'GNBR::Te::Gene:Disease', 'Disease'): 2836, ('Gene', 'GNBR::Md::Gene:Disease', 'Disease'): 1279, ('Gene', 'GNBR::G::Gene:Disease', 'Disease'): 2055, ('Gene', 'GNBR::D::Gene:Disease', 'Disease'): 500, ('Gene', 'GNBR::X::Gene:Disease', 'Disease'): 1324, ('Gene', 'GNBR::Ud::Gene:Disease', 'Disease'): 407, ('Gene', 'GNBR::V+::Gene:Gene', 'Gene'): 8689, ('Gene', 'GNBR::Q::Gene:Gene', 'Gene'): 19372, ('Gene', 'GNBR::Rg::Gene:Gene', 'Gene'): 11018, ('Gene', 'GNBR::B::Gene:Gene', 'Gene'): 8164, ('Gene', 'GNBR::I::Gene:Gene', 'Gene'): 5434, ('Gene', 'GNBR::E+::Gene:Gene', 'Gene'): 10838, ('Gene', 'GNBR::H::Gene:Gene', 'Gene'): 2509, ('Gene', 'GNBR::W::Gene:Gene', 'Gene'): 280, ('Gene', 'GNBR::E::Gene:Gene', 'Gene'): 418, ('Gene', 'GNBR:in_tax::Gene:Tax', 'Tax'): 14663, ('Gene', 'Hetionet::GpBP::Gene:Biological Process', 'Biological Process'): 559504, ('Gene', 'Hetionet::GiG::Gene:Gene', 'Gene'): 147164, ('Compound', 'Hetionet::CrC::Compound:Compound', 'Compound'): 6486, ('Disease', 'Hetionet::DdG::Disease:Gene', 'Gene'): 7623, ('Disease', 'Hetionet::DpS::Disease:Symptom', 'Symptom'): 3357, ('Disease', 'Hetionet::DlA::Disease:Anatomy', 'Anatomy'): 3602, ('Compound', 'Hetionet::CtD::Compound:Disease', 'Disease'): 755, ('Compound', 'Hetionet::CbG::Compound:Gene', 'Gene'): 11571, ('Compound', 'Hetionet::CuG::Compound:Gene', 'Gene'): 18756, ('Disease', 'Hetionet::DrD::Disease:Disease', 'Disease'): 543, ('Disease', 'Hetionet::DaG::Disease:Gene', 'Gene'): 12623, ('Compound', 'Hetionet::CpD::Compound:Disease', 'Disease'): 390, ('Anatomy', 'Hetionet::AdG::Anatomy:Gene', 'Gene'): 102240, ('Anatomy', 'Hetionet::AuG::Anatomy:Gene', 'Gene'): 97848, ('Gene', 'Hetionet::GcG::Gene:Gene', 'Gene'): 61690, ('Gene', 'Hetionet::GpMF::Gene:Molecular Function', 'Molecular Function'): 97222, ('Pharmacologic Class', 'Hetionet::PCiC::Pharmacologic Class:Compound', 'Compound'): 1029, ('Gene', 'Hetionet::GpCC::Gene:Cellular Component', 'Cellular Component'): 73566, ('Gene', 'Hetionet::Gr>G::Gene:Gene', 'Gene'): 265672, ('Compound', 'Hetionet::CdG::Compound:Gene', 'Gene'): 21102, ('Disease', 'Hetionet::DuG::Disease:Gene', 'Gene'): 7731, ('Gene', 'Hetionet::GpPW::Gene:Pathway', 'Pathway'): 84372, ('Compound', 'Hetionet::CcSE::Compound:Side Effect', 'Side Effect'): 138944, ('Anatomy', 'Hetionet::AeG::Anatomy:Gene', 'Gene'): 526407, ('Compound', 'INTACT::PHYSICAL ASSOCIATION::Compound:Gene', 'Gene'): 203, ('Compound', 'INTACT::DIRECT INTERACTION::Compound:Gene', 'Gene'): 155, ('Compound', 'INTACT::ASSOCIATION::Compound:Gene', 'Gene'): 1447, ('Gene', 'INTACT::ASSOCIATION::Gene:Gene', 'Gene'): 112390, ('Gene', 'INTACT::PHYSICAL ASSOCIATION::Gene:Gene', 'Gene'): 129318, ('Gene', 'INTACT::COLOCALIZATION::Gene:Gene', 'Gene'): 3468, ('Gene', 'INTACT::DEPHOSPHORYLATION REACTION::Gene:Gene', 'Gene'): 303, ('Gene', 'INTACT::CLEAVAGE REACTION::Gene:Gene', 'Gene'): 93, ('Gene', 'INTACT::DIRECT INTERACTION::Gene:Gene', 'Gene'): 6950, ('Gene', 'INTACT::PHOSPHORYLATION REACTION::Gene:Gene', 'Gene'): 1328, ('Gene', 'INTACT::ADP RIBOSYLATION REACTION::Gene:Gene', 'Gene'): 58, ('Gene', 'INTACT::UBIQUITINATION REACTION::Gene:Gene', 'Gene'): 371, ('Gene', 'INTACT::PROTEIN CLEAVAGE::Gene:Gene', 'Gene'): 67, ('Gene', 'STRING::REACTION::Gene:Gene', 'Gene'): 400426, ('Gene', 'STRING::CATALYSIS::Gene:Gene', 'Gene'): 343533, ('Gene', 'STRING::ACTIVATION::Gene:Gene', 'Gene'): 81355, ('Gene', 'STRING::INHIBITION::Gene:Gene', 'Gene'): 28959, ('Gene', 'STRING::OTHER::Gene:Gene', 'Gene'): 310690, ('Gene', 'STRING::BINDING::Gene:Gene', 'Gene'): 315875, ('Gene', 'STRING::PTMOD::Gene:Gene', 'Gene'): 15113, ('Gene', 'STRING::EXPRESSION::Gene:Gene', 'Gene'): 757},\n",
      "      metagraph=[('Anatomy', 'Gene'), ('Anatomy', 'Gene'), ('Anatomy', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Gene'), ('Gene', 'Compound'), ('Gene', 'Compound'), ('Gene', 'Compound'), ('Gene', 'Compound'), ('Gene', 'Compound'), ('Gene', 'Compound'), ('Gene', 'Compound'), ('Gene', 'Compound'), ('Gene', 'Compound'), ('Gene', 'Compound'), ('Gene', 'Compound'), ('Gene', 'Compound'), ('Gene', 'Compound'), ('Gene', 'Disease'), ('Gene', 'Disease'), ('Gene', 'Disease'), ('Gene', 'Disease'), ('Gene', 'Disease'), ('Gene', 'Disease'), ('Gene', 'Disease'), ('Gene', 'Disease'), ('Gene', 'Disease'), ('Gene', 'Disease'), ('Gene', 'Tax'), ('Gene', 'Biological Process'), ('Gene', 'Molecular Function'), ('Gene', 'Cellular Component'), ('Gene', 'Pathway'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Gene'), ('Compound', 'Atc'), ('Compound', 'Compound'), ('Compound', 'Compound'), ('Compound', 'Disease'), ('Compound', 'Disease'), ('Compound', 'Disease'), ('Compound', 'Disease'), ('Compound', 'Disease'), ('Compound', 'Disease'), ('Compound', 'Disease'), ('Compound', 'Disease'), ('Compound', 'Disease'), ('Compound', 'Side Effect'), ('Disease', 'Gene'), ('Disease', 'Gene'), ('Disease', 'Gene'), ('Disease', 'Gene'), ('Disease', 'Gene'), ('Disease', 'Symptom'), ('Disease', 'Anatomy'), ('Disease', 'Disease'), ('Pharmacologic Class', 'Compound')])\n"
     ]
    }
   ],
   "source": [
    "print(graph)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
